
const Koa = require('koa');
const app = new Koa();
const path = require('path');
const koaStatic = require('koa-static');
const Router = require('koa-router');
const router = new Router();
const fs = require('fs')
app.use(koaStatic(
    path.join(__dirname, './build')
));

router.get('/chakra', async ctx => {
    ctx.type = "text/html;charset=utf-8"
    const res = fs.readFileSync(path.join(__dirname, 'build/index.html'), 'utf-8')
    ctx.body = res
})
app.use(router.routes()).use(router.allowedMethods());

app.listen(3001, () => {
    console.log(`Node server has been started on http://localhost:3001`)
});
